Skip to content

Support x-keep-typed-in-additional-properties in Python model generator#3665

Open
charlie-zhang109 wants to merge 2 commits into
masterfrom
czhang/typed-fields-in-additional-properties
Open

Support x-keep-typed-in-additional-properties in Python model generator#3665
charlie-zhang109 wants to merge 2 commits into
masterfrom
czhang/typed-fields-in-additional-properties

Conversation

@charlie-zhang109

Copy link
Copy Markdown
Contributor

What does this PR do?

When a schema sets x-keep-typed-in-additional-properties: true (introduced in DataDog/datadog-api-spec#5941), the Python model generator emits a _keep_typed_in_additional_properties = True class attribute.

In Python, all fields (typed and untyped) are already stored in _data_store and accessible via both model.python_attr and model["json_key"] syntax — no deserialization change is needed. The class attribute is a marker for tooling and for consistency with other SDK clients.

The first consumer is UsageSummaryDate, UsageSummaryDateOrg, and UsageSummaryResponse.

Companion PRs:

Review checklist

  • This PR includes all newly recorded cassettes for any modified tests.

  • This PR does not rely on API client schema changes.

    • The CI should be fully passing.
  • Or, this PR relies on API schema changes and this is a Draft PR to include tests for that new functionality.

When a schema sets `x-keep-typed-in-additional-properties: true`, emit a
`_keep_typed_in_additional_properties = True` class attribute. In Python all
fields are already stored in `_data_store` and accessible via `model["key"]`
regardless of type; this marker makes the intent explicit for tooling.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
charlie-zhang109

This comment was marked as resolved.

…mantic marker

In Python, typed fields are already reachable via bracket notation through
_data_store, so no runtime behaviour change is required. The marker makes the
flag visible for introspection and aligns semantics with other language SDKs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@charlie-zhang109 charlie-zhang109 marked this pull request as ready for review June 8, 2026 15:23
@charlie-zhang109 charlie-zhang109 requested review from a team as code owners June 8, 2026 15:23
@datadog-datadog-prod-us1

Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

Ensure labels | changelog   View in Datadog   GitHub Actions

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: e032471 | Docs | Datadog PR Page | Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant